package ihm.bean.administration.pays;

import ihm.outils.UtilsJsf;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import metier.model.Pays;
import metier.service.AdministrationPaysService;
import org.primefaces.context.RequestContext;

@ManagedBean
@ViewScoped
public class AdministrationPaysDetailsController {

    @EJB
    private AdministrationPaysService administrationPaysService;

    private Pays pays;

    public AdministrationPaysDetailsController() {
    }

    @PostConstruct
    private void initialisation() {
        Integer id = Integer.valueOf(UtilsJsf.getHttpParameter("id"));
        pays = administrationPaysService.lireParId(id);
    }

    public void supprimer() {
        System.out.println("test");
        RequestContext.getCurrentInstance().execute("$('#modal_suppression_pays').modal('hide')");
    }

    public Pays getPays() {
        return pays;
    }

    public void setPays(Pays pays) {
        this.pays = pays;
    }

}
